<template>
  <div>
    <SkuList @setSkuInfo="setSkuInfo" v-if="showNum === 1" />
    <AddSku
      v-else
      :toAddSkuData="skuId"
      @changShowNum="showNum = $event"
      :skuInfo="skuInfo"
    />
  </div>
</template>

<script>
import SkuList from './skuList'
import AddSku from '../spu/addSku/idnex.vue'
export default {
  name: 'SKU',
  components: { SkuList, AddSku },
  data() {
    return {
      showNum: 1, // 1 为sku列表页  2为编辑sku页
      skuId: {
        spuName: '',
        id: undefined
      },
      skuInfo: {}
    }
  },
  methods: {
    setSkuInfo(data) {
      this.skuId.id = data.spuId
      this.showNum = 2
      this.skuInfo = data
    }
  }
}
</script>

<style scoped>
.sku-img {
  height: 80px;
}
</style>
